package com.xcc.httpUtils.callback;

import okhttp3.Call;
import okhttp3.Response;

import java.io.IOException;

/**
 * Created by Carman on 2017/7/7.
 * 响应结果为字符串的回调请求
 */
public abstract class StringHttpCallBack extends BaseHttpCallBack {

    @Override
    public void requestSuccess(Call call, Response response) {
        try {
            requestSuccess(call, response.body().string());
        } catch (IOException e) {
            e.printStackTrace();
            requestError(call, e);
        }
    }

    /**
     * 请求成功
     *
     * @param call   OkHttp Call 对象
     * @param result 返回的字符创
     */
    abstract public void requestSuccess(Call call, String result);
}
